package interview.throwable;

import jdk.jfr.events.ErrorThrownEvent;

import java.io.FileNotFoundException;

/**
 * @Author: cctv
 * @Date: 2019/5/22 16:09
 */
public class ErrorAndException {
    private void throwError(){
        throw new StackOverflowError();
    }
    private void throwRuntimeException(){
        throw new RuntimeException();
    }
    // 最佳实践是不要吃下异常 要抛出去 且不要粗化异常类型
    private void throwCheckedException() throws FileNotFoundException {
        throw new FileNotFoundException();
    }

    public static void main(String[] args) throws FileNotFoundException {
        ErrorAndException eae = new ErrorAndException();
        eae.throwError();
        eae.throwRuntimeException();
        eae.throwCheckedException();
    }
}
